package com.yzh.openai.domain.order.repositoy;

import com.yzh.openai.domain.order.model.aggregates.CreateOrderAggregate;
import com.yzh.openai.domain.order.model.entity.PayOrderEntity;
import com.yzh.openai.domain.order.model.entity.ProductEntity;
import com.yzh.openai.domain.order.model.entity.ShopCartEntity;
import com.yzh.openai.domain.order.model.entity.UnpaidOrderEntity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 订单仓储接口
 */
public interface IOrderRepository {
    /**
     * 查询未支付且有效的订单
     * @param shopCartEntity
     * @return
     */
    UnpaidOrderEntity queryUnpaidOrder(ShopCartEntity shopCartEntity);
    /**
     * 查询商品
     * @param productId
     * @return
     */
    ProductEntity queryProduct(Integer productId);
    /**
     * 保存订单
     * @param aggregate
     */
    void saveOrder(CreateOrderAggregate aggregate);
    /**
     * 更新订单付款信息
     * @param payOrderEntity
     */
    void updateOrderPayInfo(PayOrderEntity payOrderEntity);
    /**
     * 更新支付成功
     * @param orderId
     * @param transactionId
     * @param totalAmount
     * @param payTime
     * @return
     */
    boolean changeOrderPaySuccess(String orderId, String transactionId, BigDecimal totalAmount, Date payTime);
    /**
     * 查询订单
     * @param orderId
     * @return
     */
    CreateOrderAggregate queryOrder(String orderId);
    /**
     * 发货
     * @param orderId
     */
    void deliverGoods(String orderId);
    /**
     * 查询待补货订单
     * @return
     */
    List<String> queryReplenishmentOrder();
    
    /**
     * 查询未支付订单
     * @return
     */
    List<String> queryNoPayNotifyOrderList();
    String queryNoPayNotifyOrder();
    /**
     * 查询超时订单
     * @return
     */
    List<String> queryTimeoutCloseOrderList();
    /**
     * 关闭订单(超时未支付的)
     * @param orderId
     * @return
     */
    boolean changeOrderClose(String orderId);
    /**
     * 查询商品
     * @return
     */
    List<ProductEntity> queryProductList();
}
